<!DOCTYPE html>
<html>
<meta charset="utf-8">
<link href="/css/layui.css" rel="stylesheet">
<head th:include="include :: header">
	<title>编辑商品</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${product.id}"  type="hidden">
						<div class="form-group">
							<label class="col-sm-2 control-label">图片：</label>
							<div class="col-sm-4">
								<!--<input id="picturl" name="picturl" class="form-control" type="text">-->
								<button type="button" class="layui-btn" id="test1">上传图片</button>
							</div>
							<div class="col-sm-6">
								<!--预览图片-->
								<input id="picturl" name="picturl" class="form-control" th:value="${product.picturl}" type="hidden">
								<img class="layui-upload-img" id="demo1" th:src="${product.picturl}">
								<!--提示上传信息-->
								<p id="demoText"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">产品编号：</label>
							<div class="col-sm-4">
								<input id="sku" name="sku" class="form-control" th:value="${product.sku}" type="text" readonly>
							</div>
							<label class="col-sm-2 control-label">状态：</label>
							<div class="col-sm-4">
								<select data-placeholder="--选择状态--" name="status" id="status"
										class="form-control chosen-select" tabindex="2">
									<option value="">-- 选择状态 --</option>
									<option th:each="prosta : ${prostatus}" th:value="${prosta.value}"
											th:text="${prosta.name}" th:selected="'checked' eq ${prosta.remarks}"></option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">产品名称：</label>
							<div class="col-sm-10">
								<input id="name" name="name" class="form-control" th:value="${product.name}" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">品牌：</label>
							<div class="col-sm-4">
								<input id="proBrand" name="proBrand" class="form-control" th:value="${product.proBrand}" type="text">
							</div>
							<label class="col-sm-2 control-label">采购价：</label>
							<div class="col-sm-4">
								<input id="purPrice" name="purPrice" class="form-control" th:value="${product.purPrice}" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">总库存：</label>
							<div class="col-sm-4">
								<input id="allQty" name="allQty" class="form-control" th:value="${product.allQty}" type="text">
							</div>
							<label class="col-sm-2 control-label">总出库数量：</label>
							<div class="col-sm-4">
								<input id="allOutqty" name="allOutqty" class="form-control" th:value="${product.allOutqty}" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">产品型号：</label>
							<div class="col-sm-4">
								<input id="proModel" name="proModel" class="form-control" th:value="${product.proModel}" type="text">
							</div>
							<label class="col-sm-2 control-label">产品产地：</label>
							<div class="col-sm-4">
								<input id="picOrigin" name="picOrigin" class="form-control" th:value="${product.picOrigin}" type="text">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">产品规格：</label>
							<div class="col-sm-10">
								<textarea id="proSpec" name="proSpec" class="form-control" th:text="${product.proSpec}"></textarea>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">备注：</label>
							<div class="col-sm-10">
								<textarea id="remarks" name="remarks" class="form-control" th:text="${product.remarks}" ></textarea>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button shiro:hasPermission="pro:product:edit" type="submit" class="btn btn-primary">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/pro/product/edit.js">
</script>
<script src="/js/layui.js"></script>
<script type="text/javascript">
	layui.use('upload', function () {
		var upload = layui.upload;
		//执行实例
		var uploadInst = upload.render({
			elem: '#test1', //绑定元素
			url: '/common/sysFile/upload', //上传接口
			size: 1000,
			accept: 'file',
			before: function(obj){
				//预读本地文件示例，不支持ie8
				obj.preview(function(index, file, result){
					$('#demo1').attr('src', result); //图片链接（base64）
				});
			},
			done: function (r) {
				//console.log(r);
				//alert(r.fileName);
				//console.log(r.fileName);
				$("#picturl").val(r.fileName);
				layer.msg(r.msg);
				// app.getData();
			},
			error: function (r) {
				layer.msg(r.msg);
			}
		});
	});
</script>
</body>
</html>
